<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JSPang</title>
    <style>
        .animation {
            animation: leftToRight 3s;
        }

        @keyframes leftToRight {
            0% {
                transform: translateX(0px);
            }

            25% {
                transform: translateX(25px);
            }

            50% {
                transform: translateX(50px);
            }

            75% {
                transform: translateX(25px);
            }

            100% {
                transform: translateX(0px);
            }

        }
    </style>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.0.2/vue.global.js"></script>

</head>

<body>
    <div id="app"></div>
</body>
<script>
    const app = Vue.createApp({
        data() {
            return {
                isAnimate: {
                    animation: false
                }
            }
        },
        methods: {
            handleClick() {
                this.isAnimate.animation = !this.isAnimate.animation
            }
        },
        template: `  
            <div :class="isAnimate">技术胖讲程序</div>
            <div><button @click="handleClick">启动/关闭</button></div>
        `
    })
    const vm = app.mount("#app")
</script>